<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" value="自首" onclick=" method01()" height="20px" width="50px" size="20px">
<input type="button" value="单击" onclick="method02()" height="20px" width="50px" size="20px">

</body>


<script>
    function method01(){
      let a= confirm("您违法了吗？")
        if(a){
            location.href="http://www.baidu.com";
        }else{

            location.href="http://www.bilibili.com";

        }
    }

    let method02 =function (){
        console.log("您已单击");
    }

let student={
        name:"张三",
            age:18,
            study: function (){
            document.write("娃在学习");

        }


    }
    student.name
    student.age
    student.study()

</script>
</html>